#include <iostream>
#include <map>
#include <string>
using namespace std;

int main()
{
    string s;
    getline(cin,s);
    map<char,int>l;
    for (int i=0;i<s.size();i++)
    {
        char c=s[i];
        if (c>='a'&&c<='z')
        {
            if (l.find(c)!=l.end())
                l[c]+=1;
            else
                l[c]=1;
        }
        else if (c>='A'&&c<='Z')
        {
            if (l.find(c-'A'+'a')!=l.end())
                l[c-'A'+'a']+=1;
            else
                l[c-'A'+'a']=1;
        }
    }
    char maxc;
    int maxn=0;
    for (auto i:l)
    {
        if (i.second>maxn)
        {
            maxn=i.second;
            maxc=i.first;
        }
    }
    cout<<maxc<<" "<<maxn;
}